local SkillBehavior = require("gameLogic.fightSkill.show.SkillBehavior")
local SkillInPlace = class("SkillInPlace", SkillBehavior)
local AnimConst = require("const.AnimConst")
local GameUtils = require("utils.GameUtils")
local FightHelper = require("gameLogic.fight.FightHelper")
local cs_coroutine = require("utils.cs_corutine")
-- 站在原地释放技能

function SkillInPlace:ctor(config)
    SkillInPlace.super.ctor(self, config)
end

function SkillInPlace:attack(index)
    if not self._entity then
        return
    end
    local targets = self:getSkillTargets(index)
    if not targets then
        return
    end
    local hitTime = self:getHitTime()
    local stragyTime = self:getEffectTime()

    local sequence = DOTween.Sequence()
    local oldEulerAngles = self._entity:getRoot().localEulerAngles
    
    local goLookAt = self._entity:getRoot():DOLookAt(targets[1].transform.position, 0.2)
    
    local goAttackFunc = function()
        self._entity:triggerAnim(self:getSkillAction() .. "Trigger")
    end
    local hitFunc = function()
        self:strategy(targets)
    end

    local goRotate = self._entity:getRoot():DOLocalRotate(oldEulerAngles, 0.2)

    local goDone = function()
        self._entity:setDone(true)
    end

    sequence:AppendInterval(0.5)
    sequence:Append(goLookAt)
    sequence:AppendCallback(goAttackFunc)
    sequence:AppendInterval(hitTime)
    sequence:AppendCallback(hitFunc)
    sequence:AppendInterval(stragyTime)
    sequence:Append(goRotate)
    sequence:AppendCallback(goDone)
end

return SkillInPlace
